﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Caller.aspx.cs" Inherits="Caller" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.3.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <table>
        <tbody>
          <tr>
            <th>Name</th>
            <td>
              <asp:Label ID="lbName" runat="server" Text="JELLY" />
            </td>
          </tr>
          <tr>
            <th>No</th>
            <td>
              <asp:Label ID="lbID" runat="server" Text="1" />
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <div>
      <asp:Button ID="btnEdit" runat="server" Text="Edit" />
    </div>
    </form>
    
    <script type="text/javascript">

      $(function() {
        $('#btnEdit').click(function() {

          function LoadUserInfo() {
            var UserInfo = {};

            UserInfo.Name = $('#lbName').text();
            UserInfo.ID = $('#lbID').text();

            return UserInfo;
          }

          function SaveUserInfo(UserInfo) {
            $('#lbName').text(UserInfo.Name);
            $('#lbID').text(UserInfo.ID);
          }

          var UserInfo = LoadUserInfo();

          var callee = openCallee();
          callee.CallerInfo = {
            UserInfo: UserInfo,
            SaveUserInfo: SaveUserInfo
          };

          return false;

          function openCallee() {
            var width = 400;
            var height = 300;
            var left = parseInt((screen.availWidth / 2) - (width / 2));
            var top = parseInt((screen.availHeight / 2) - (height / 2));
            var windowProperties = 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left + ', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no';
            
            return window.open('Callee.aspx', 'Callee', windowProperties);
          }

        });
      });

      /*
      function openCenteredWindow(url) {
        var width = 400;
        var height = 300;
        var left = parseInt((screen.availWidth / 2) - (width / 2));
        var top = parseInt((screen.availHeight / 2) - (height / 2));
        var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
        myWindow = window.open(url, "subWind", windowFeatures);
      }
      */
    </script>
</body>
</html>
